package net.wsfcp.android.http.mvp.presenter;

import net.wsfcp.android.base.BasePresenter;
import net.wsfcp.android.bean.resultbean.OrderBean;
import net.wsfcp.android.http.mvp.IModel;
import net.wsfcp.android.http.mvp.contract.OrderListContract;
import net.wsfcp.android.http.mvp.model.OrderListModel;
import net.wsfcp.android.ui.view.my.activity.OrderDetailActivity;

import java.util.HashMap;

/**
 * Created by Shaoboyang on 2018/12/14.
 */
//订单详情
public class OrderDetailPresenter extends BasePresenter<OrderDetailActivity> implements
        OrderListContract.OrderListPresenter {


    @Override
    public void getOrderList(int page, int pagesize, int status) {

    }

    @Override
    public void cancelOrder(String id) {
        ((OrderListModel) getiModelMap().get("cancel")).cancelOrder(id, new OrderListModel
                .CancelOrderInfoHint() {
            @Override
            public void cancelOrderSuccessInfo() {
                getIView().cancelOrderSuccess();
            }

            @Override
            public void cancelOrderFailInfo(String str) {
                getIView().cancelOrderFail(str);
            }


        });
    }

    @Override
    public void confirmReceipt(String id) {
        ((OrderListModel) getiModelMap().get("confirm")).confirmReceipt(id, new OrderListModel
                .ConfirmReceiptInfoHint() {
            @Override
            public void confirmReceiptSuccessInfo() {
                getIView().confirmReceiptSuccess();
            }

            @Override
            public void confirmReceiptFailInfo(String str) {
                getIView().confirmReceiptFail(str);
            }


        });

    }

    @Override
    public void getOrderDetail(String id) {
        ((OrderListModel) getiModelMap().get("detail")).getOrderDetail(id, new OrderListModel
                .GetOrderDetailInfoHint() {
            @Override
            public void getOrderDetailSuccessInfo(OrderBean.OrderList bean) {
                getIView().getOrderDetailSuccess(bean);
            }

            @Override
            public void getOrderDetailFailInfo(String str) {
                getIView().getOrderDetailFail(str);
            }


        });

    }


    @Override
    public HashMap<String, IModel> getiModelMap() {
        return loadModelMap(new OrderListModel());
    }

    @Override
    public HashMap<String, IModel> loadModelMap(IModel... models) {
        HashMap<String, IModel> map = new HashMap<>();
        map.put("detail", models[0]);
        map.put("cancel", models[0]);
        map.put("confirm", models[0]);
        return map;
    }


}
